<template>
	<view>
		<view v-if="!newsList||newsList.length==0" style="color: #CCCCCC;text-align: center;width: 100%;height: 500upx;line-height: 500upx;font-size: 32upx;"> 暂无相关消息</view>
		<view v-else v-for="(item,index) in newsList" :key="index">
			<view class="un-systemNews-time">
				<text>{{item.CREATEDATE}}</text>
			</view>
			<view class="un-systemNews-item">
				<view class="clamp un-n1">
					<text>{{item.TITLE}}</text>
					<text class="iconfont icon-shouye1 un-icon1"></text>
				</view>
				<view class="un-n3" @click="navToNewsDetailPage(item)">
					<view class="un-n4">
						<text>{{item.DESCRIBE}}</text>
					</view>
					<text class="iconfont icon-youjiantou un-icon"></text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				newsList:[],
			}
		},
		onLoad() {
			this.loadData()
			uni.startPullDownRefresh();
		},
		onPullDownRefresh() {
			console.log('refresh');
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onNavigationBarButtonTap() {
			this.newsList=[]
			//调方法
		},
		methods: {
			//加载公告
			async loadData(){
				//加载信息
				this.$http.post("/ad/querySystemNews",{
					SIGNATURE : uni.getStorageSync("SIGNATURE"),
					TYPE:3,
				}).then((e)=>{
					this.newsList = e.data.OBJECT
				}).catch((err)=>{
					console.log("请求超时",err);
				})
			},
			//消息详情页面
			navToNewsDetailPage(item){
				let id=item.ID;
				// uni.navigateTo({
				// 	url: '/pages/news/newsdetail?id='+id
				// });
			},
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #F5F5F5;
		border-top: 1upx solid #F2F2F2;
	}
	.un-systemNews-time{
		text-align: center;
		font-size: 25upx;
		color: #CCCCCC;
		margin: 30upx 0upx;
	}
	.un-systemNews-item{
		margin: 0upx 30upx;
		background-color: #FFFFFF;
		padding: 30upx;
		border: 1upx solid #F2F2F2;
		.un-n1{
			font-size: 28upx;
			color: #666666;
			margin-bottom: 20upx;
			position: relative;
			.un-icon1{
				position: absolute;
				z-index: 1;
				left: 580upx;
				color: #FF5914;
				font-size: 40upx;
			}
		}
		.un-n3{
			border-top: 1upx solid #F2F2F2;
			padding-top: 20upx;
			font-size: 25upx;
			color: #999999;
			display: flex;
			align-items: center;
			line-height: 45upx;
		}
		.un-n4{
			width: 90%;
		}
		.un-icon{
			margin-left: 30upx;
			font-size: 40upx;
		}
	}
</style>
